﻿using Microsoft.AspNetCore.Http;
using NPOI.SS.UserModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ExcelHelperSpace
{
    /// <summary>
    /// excel 映射类
    /// </summary>
    public interface IExcelMapper
    {

        /// <summary>
        /// 初始化参数
        /// </summary>
        void ExcelInit(ExcelClass excelClass);

        /// <summary>
        /// Excel To List
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="path">文件绝对路径</param>
        /// <returns></returns>
        IEnumerable<T> ExcelToList<T>(string path);

        /// <summary>
        /// Excel To List
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="file"></param>
        /// <returns></returns>
        IEnumerable<T> ExcelToList<T>(IFormFile file);

        /// <summary>
        /// Excel To List
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="write">文件流</param>
        /// <returns></returns>
        IEnumerable<T> ExcelToList<T>(MemoryStream write);

        /// <summary>
        /// List To Excel
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="list">object T</param>
        /// <param name="sheetName">Sheet</param>
        /// <returns></returns>
        byte[] GListToExcel<T>(IEnumerable<T> list, string sheetName = "Sheet1");

    }
}
